#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
#include<queue>
#include<stack>

using namespace std;

class Solution {
public:
    int xt[5] = { 0,0,1,-1 };
    int yt[5] = { 1,-1,0,0 };
    vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc, int color) {
        int t = image[sr][sc];
        queue<pair<int, int>> qt;
        qt.push({ sr,sc });
        int n = image.size(), m = image[0].size();
        vector<vector<int>> visted(n, vector(m, 0));
        while (qt.size())
        {
            auto [x, y] = qt.front();
            image[x][y] = color;
            visted[x][y] = 1;
            qt.pop();
            for (int i = 0; i < 4; i++)
            {
                int xi = xt[i] + x;
                int yi = yt[i] + y;
                if (xi >= 0 && yi >= 0 && xi < n && yi < m && image[xi][yi] == t && visted[xi][yi] != 1) qt.push({ xi,yi });
            }
        }
        return image;
    }
};

int main() {
    return 0;
}